import requests

class LoginApi(object):
    @classmethod
    def get_verify(cls, session):
        session.get(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=verify")

    @classmethod
    def login(cls, session, data):
        res = session.post(url="http://hmshop-test.itheima.net/index.php?m=Home&c=User&a=do_login",data=data)
        return res


if __name__ == '__main__':
    session = requests.Session()
    LoginApi.get_verify(session)
    login_data = {"username": "13800000001", "password": "123456", "verify_code": "8888"}
    response = LoginApi.login(session, login_data)
    print("登录结果：", response.json())